package com.lilong.jwt.controller.user;

import com.lilong.jwt.common.base.BaseService;
import com.lilong.jwt.common.base.CommonController;
import com.lilong.jwt.common.util.ResultBean;
import com.lilong.jwt.common.util.ResultUtil;
import com.lilong.jwt.entity.user.Role;
import com.lilong.jwt.service.user.RoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/sys/role/")
public class RoleController extends CommonController<Role> {
    @Resource
    private RoleService roleService;

    @Override
    protected BaseService<Role> getService() {
        return roleService;
    }

    /**
     * 获取所有可用权限
     */
    @GetMapping("permission")
    public ResultBean getPermission() {
        return ResultUtil.SUCCESS(roleService.getPermissionTree());
    }

}
